Component({
  /**
   * 组件的属性列表
   */
  properties: {
    current: {
      type: Number,
      value: 0
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    tabList: [
      {
        pagePath: '/pages/index/index',
        text: '最新视频',
        iconPath: '/images/video.svg',
        selectedIconPath: '/images/video-active.svg'
      },
      {
        pagePath: '/pages/article/article',
        text: '最新祝福',
        iconPath: '/images/article.svg',
        selectedIconPath: '/images/article-active.svg'
      }
    ]
  },

  /**
   * 组件的方法列表
   */
  methods: {
    switchTab(e) {
      const index = e.currentTarget.dataset.index;
      const path = this.data.tabList[index].pagePath;
      
      // 触发父组件事件
      this.triggerEvent('tabchange', { index, path });
      
      // 页面跳转 - 使用reLaunch确保能正常跳转
      wx.reLaunch({
        url: path
      });
    }
  }
});